package cn.org.mrliu.code.generator.bean;

import java.io.Serializable;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

public class Column implements Serializable {
	private static final long serialVersionUID = -2154553896024875670L;
	private Integer ordinal;
	private String name;
	private String comment;
	private DataType dataType;
	private Integer length;
	private String defaultValue;
	private Boolean isNullable;
	private String key;
	private String placeholderSimpleName;
	private String placeholderName;

	public Column() {
		super();
	}

	public Column(Integer ordinal, String name, String comment, String jdbcType, Integer length, String defaultValue,
			Boolean isNullable, String key) {
		super();
		this.ordinal = ordinal;
		this.name = name;
		this.comment = comment;
		this.dataType = new DataType(jdbcType);
		this.length = length;
		this.defaultValue = defaultValue;
		this.isNullable = isNullable;
		this.key = key;
	}

	public Integer getOrdinal() {
		return ordinal;
	}

	public void setOrdinal(Integer ordinal) {
		this.ordinal = ordinal;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getComment() {
		return comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}

	public DataType getDataType() {
		return dataType;
	}

	public void setDataType(DataType dataType) {
		this.dataType = dataType;
	}

	public Integer getLength() {
		return length;
	}

	public void setLength(Integer length) {
		this.length = length;
	}

	public String getDefaultValue() {
		return defaultValue;
	}

	public void setDefaultValue(String defaultValue) {
		this.defaultValue = defaultValue;
	}

	public Boolean getIsNullable() {
		return isNullable;
	}

	public void setIsNullable(Boolean isNullable) {
		this.isNullable = isNullable;
	}

	public String getKey() {
		return key;
	}

	public void setKey(String key) {
		this.key = key;
	}

	public String getPlaceholderSimpleName() {
		return placeholderSimpleName;
	}

	public void setPlaceholderSimpleName(String placeholderSimpleName) {
		this.placeholderSimpleName = placeholderSimpleName;
	}

	public String getPlaceholderName() {
		return placeholderName;
	}

	public void setPlaceholderName(String placeholderName) {
		this.placeholderName = placeholderName;
	}

	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this,ToStringStyle.MULTI_LINE_STYLE);
	}
}
